package com.lxj.collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.lxj.charactor.Hero;
import com.lxj.property.Item;

/**
 * TestCollect
 */
public class TestCollect {

    public static void main(String[] args) {
        // List<Hero,Item> genericheros = new ArrayList<Hero,Item>();
        // genericheros.add(new Hero("概论"));
        // genericheros.add(new Item());

        List<Hero> heros = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            heros.add(new Hero("hero nae"+i));
        }

        // 迭代器遍历
        Iterator<Hero> it = heros.iterator();

        while (it.hasNext()) {
            Hero h = it.next();
            System.out.println(h.name);
        }

    }
}